#ifndef _UTILITIES_H
#define _UTILITIES_H
#include "TLVUtil.h"

#define MAX_TLV_TAG_SZ      32 // use static memory

typedef struct _Bytes{
	int  size;
	unsigned char *data;
}Bytes, *pBytes;

typedef struct _TlvData{
	Bytes tag;
	Bytes val;
}TlvData, *pTlvData;

int parse_tlv_length(pBytes tlv, unsigned char *src);

int parse_tlv_data(unsigned char *buf, unsigned char *tag, unsigned char *src, int size);

int parse_tlv_data_tmplt(unsigned char *buf, unsigned char *tag, unsigned char *tmplt, unsigned char *src, int size);

int count_tlv_substring(unsigned char *src, int size);

int unpack_tlv_data(pTlvData dst, unsigned char *src, int size);

int pack_tlv_data(unsigned char *buf, unsigned char *tag, unsigned char *src, int size);

int tlv_test(void);

#endif

